<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class BookmarkRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        // 包含了 authorize 方法。在这个方法中，你可以检查经过身份验证的用户确定其是否具有更新给定资源的权限。
        //false代表权限验证不通过，返回403错误  // true代表权限认证通过
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id' => ['numeric'],
            'user_id' => ['required', 'numeric'],
            'title' => ['required', 'string'],
            'url' => ['required', 'url'],
            'category_id' => ['required', 'numeric'],
            'summary' => ['string'],
            'status' => ['required', 'numeric', 'max:255']
        ];
    }
}
